<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
    <script src="http://unpkg.com/vue/dist/vue.js"></script>
    <script src="https://cdn.jsdelivr.net/vue.resource/1.0.3/vue-resource.min.js"></script>
    <style type="css/text">
   
    </style>
</head>
<body >

      <div id="box" align="center">
         <label>token</label><input id="token" type="text" style="width:300px;" value="3f1b64414b7fa33210ce0c58a666"/>
          <br/>
        <label>url</label> <input id="url" type="text" style="width:300px;"/>
         <br/>
         <label>json</label>
        
        <textarea id="json" rows="30" cols="50" >
         
        </textarea>
         <br/>
         <input type="submit" @click="post()" value="提交"> <input type="reset" value="清空">
      </div>
     
     <script type="text/javascript">
        window.onload = function(){
            var vm = new Vue({
                el:'#box',
                data:{
                    msg:'请输入你要提交的数据',
                },
                methods:{
                	post:function(){
                		alert(1);
                        //发送get请求
                        var url = "http://localhost:8080/crawler/api/bed/"+document.getElementById("url").value; 
                        var body= document.getElementById("json").value; 
                        var token=document.getElementById("token").value;
                        
                        alert(url+"/"+body+"/"+token);
                        
                    	 this.$http.post(url,body,{
                    		 headers:{
                    			 "Access-Token":token
                    		 }
                    		 
                    	 }).then(function(res){
                             alert(JSON.stringify(res.body));    
                             document.getElementById("json").value="";
                         },function(){
                             alert('请求失败处理');   //失败处理
                         });
                    }
                }
            });
        }
    </script>
</body>
</html>